]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Add timestamp property to items
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 3 Aug 2022 06:12:28 +0000 (08:12 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Aug 2022 12:17:19 +0000 (12:17 +0000)
Connections have a timestamp property, which records the last time
it was succesfully activated. This is useful information to us, as
more recently used connections are likely more relevant than ones
that haven't been used for a long time (or not at all).

To make use of it in the future, expose that timestamp as a property.

Only connections support it, but we will soon provide a reasonable
value for devices as well, so add the property to the base class.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>

js/ui/status/network.js

index 7370af9858496b0d6d1aec9678b0324ce87ba45a..98e50dbee13e34926f6ca62a94e5d800bcd66f5e 100644 (file)
@@ -161,6 +161,10 @@ const NMMenuItem = GObject.registerClass({
         return this.state <= NM.ActiveConnectionState.ACTIVATED;
     }
 
+    get timestamp() {
+        return 0;
+    }
+
     activate() {
         super.activate(Clutter.get_current_event());
     }
@@ -301,6 +305,10 @@ class NMConnectionItem extends NMMenuItem {
         return this._connection.get_id();
     }
 
+    get timestamp() {
+        return this._connection.get_setting_connection()?.get_timestamp() ?? 0;
+    }
+
     updateForConnection(connection) {
         // connection should always be the same object
         // (and object path) as this._connection, but